﻿using AutoMapper;
using Blog.Core.Model.ViewModels;
using RxxApi.Model.Entity;
namespace RxxApi.Extensions.AutoMapper;

public class CustomProfile : Profile
{
    /// <summary>
    /// 配置构造函数，用来创建关系映射
    /// </summary>
    public CustomProfile()
    {
        CreateMap<SysUser, SysUserDto>()
            .ForMember(a => a.uID, o => o.MapFrom(d => d.Id))           
            .ForMember(a => a.uLoginName, o => o.MapFrom(d => d.LoginName))
            .ForMember(a => a.uLoginPWD, o => o.MapFrom(d => d.LoginPWD));
        CreateMap<SysUserDto, SysUser>()
            .ForMember(a => a.Id, o => o.MapFrom(d => d.uID))          
            .ForMember(a => a.LoginName, o => o.MapFrom(d => d.uLoginName))
            .ForMember(a => a.LoginPWD, o => o.MapFrom(d => d.uLoginPWD));
    }
}
